package com.woniuxy.service.impl;

import com.woniuxy.dao.RbacRoleDao;
import com.woniuxy.entity.RbacRole;
import com.woniuxy.service.RbacRoleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


/**
 * (RbacRole)表服务实现类
 *
 * @author makejava
 * @since 2021-04-25 23:04:56
 */
@Service("rbacRoleService")
public class RbacRoleServiceImpl implements RbacRoleService {
    @Resource
    private RbacRoleDao rbacRoleDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public RbacRole queryById(Integer id) {
        return this.rbacRoleDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @return 对象列表
     */
    @Override
    public List<RbacRole> queryAllByLimit() {
        return this.rbacRoleDao.queryAllByLimit();
    }

    /**
     * 新增数据
     *
     * @param rbacRole 实例对象
     * @return 实例对象
     */
    @Override
    public RbacRole insert(RbacRole rbacRole) {
        this.rbacRoleDao.insert(rbacRole);
        return rbacRole;
    }

    /**
     * 修改数据
     *
     * @param rbacRole 实例对象
     * @return 实例对象
     */
    @Override
    public RbacRole update(RbacRole rbacRole) {
        this.rbacRoleDao.update(rbacRole);
        return this.queryById(rbacRole.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.rbacRoleDao.deleteById(id) > 0;
    }

    @Override
    public List<RbacRole> search(RbacRole rbacRole) {
        return this.rbacRoleDao.queryAll(rbacRole);
    }
    //废弃
    @Override
    public List<RbacRole> findPerms() {
        return null;
    }

    @Override
    public List<RbacRole> selectMenuAll() {
        return this.rbacRoleDao.selectMenuAll();
    }
}
